package com.jason.canvas.view;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.util.AttributeSet;
import android.view.View;

/**
 * @DESC:
 * @Author: Jason
 * @Date: 16/9/18
 * @Time: 22:56
 */

public class PathView7 extends View {

    private Path mPath;
    private Paint mPaint;

    public PathView7(Context context, AttributeSet attrs) {
        super(context, attrs);

        mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        mPaint.setStyle(Paint.Style.STROKE);
        mPaint.setStrokeWidth(10);
        mPaint.setColor(Color.CYAN);

        mPath = new Path();
        mPath.moveTo(100, 100);
        // 见图a99  quadTo的前两个参数为控制点的坐标，后两个参数为终点坐标
        //mPath.quadTo(200, 200, 300, 100);

        // 见图a98
        mPath.cubicTo(200, 200, 300, 0, 400, 100);


    }

    @Override
    protected void onDraw(Canvas canvas) {
        canvas.drawPath(mPath, mPaint);
    }
}
